# Replication archive for: Alexander Coppock, Kimberly Gross, Ethan Porter, Emily Thorson, and Thomas J. Wood, 
# "Conceptual Replication of Four Key Findings about Factual Corrections and Misinformation during the 2020 US Election: Evidence from Panel-Survey Experiments." 
# Forthcoming in the British Journal of Political Science doi:10.1017/S0007123422000631

library(tidyverse)
library(magrittr)
library(estimatr)
library(metafor)
library(broom)

persistence_meta <- read_rds("fitted_models/persistence_meta.rds")
t0 <- persistence_meta

t0$lucid_pid_3 %<>% 
  plyr::mapvalues(
    c("Democrat", 
      "Republican"),
    c("Democratic Subjects",
      "Republican Subjects")
  ) %>% 
  factor(
    c("All Subjects",
      "Democratic Subjects",
      "Republican Subjects")
  )

t0 %>% 
  ggplot() +
  geom_hline(
    yintercept = 0,
    linetype = "dotted"
  ) +
  geom_blank(
    aes(
      wave, estimate
    )
  ) + 
  geom_line(
    aes(
      wave, estimate, 
      group = congeniality
    ),
    size = .375,
    position = position_dodge(width = .2)
  ) +   
  geom_pointrange(
    aes(
      wave, estimate, 
      ymin  = conf.low,
      ymax  = conf.high,
      fill = congeniality
    ),
    fatten = 5,
    shape = 21,
    color = "black",
    position = position_dodge(width = .2)
  ) +
  geom_text(
    aes(
      x, y, label = lab
    ),
    data = tribble(
      ~x,  ~y, ~lab,
      2,   -15, "False claim congenial\nto Democrats",
      2,  5, "False claim congenial\nto Republicans"
    ) %>%
      mutate(
        lucid_pid_3 = "All Subjects" %>% 
          factor(
            c("All Subjects",
              "Democratic Subjects",
              "Republican Subjects")
          ),
        issues = "All Issues" %>% 
          factor(
            t0$issues %>% 
              unique
          )
      ),
    fontface = "italic",
    size = 3,
    hjust = .5,
    lineheight = .75
  ) +
  scale_x_continuous(
    breaks = 1:3,
    labels = str_c(
      "Wave ", 1:3
    ),
    expand = expansion(add = .3)
  ) +
  facet_grid(
    issues ~ lucid_pid_3,
    labeller = label_wrap_gen(15)
  ) 

